// redis客户端配置
const Redis = require('ioredis');
const config = require('dotenv').config({ path: `.env.${process.env.NODE_ENV}` });
const APP_CONFIG = config.parsed;
const redis = new Redis({
    host: 'localhost',
    port: 6379,
    username: APP_CONFIG.REDIS_USERNAME,
    password: APP_CONFIG.REDIS_PASSWORD,
    //ioredis在连接到Redis服务器时会执行INFO命令来检查服务器的状态
    enableReadyCheck: false 
});
console.log("redisClient init success!")
module.exports = redis;

